//
//  AIVipCollectionCell.m
//  Mia
//
//  Created by Vill on 2024/1/5.
//

#import "AIVipCollectionCell.h"

@interface AIVipCollectionCell ()

@property (nonatomic, strong) UIImageView *imgView;
@property (nonatomic, strong) UILabel *detailLbl;

@end

@implementation AIVipCollectionCell

-(instancetype)initWithFrame:(CGRect)frame{
    if(self = [super initWithFrame:frame]){
        [self.contentView addSubview:self.imgView];
        [self.contentView addSubview:self.detailLbl];
        [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(PTW(150), PTW(130)));
            make.centerX.mas_equalTo(self.contentView);
            make.top.mas_equalTo(self.contentView).mas_offset(PTW(32));
        }];
        [self.detailLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(self.contentView);
            make.height.mas_equalTo(PTW(55));
            make.top.mas_equalTo(self.imgView.mas_bottom).mas_offset(PTW(20));
        }];
    }
    return self;
}

- (UIImageView *)imgView{
    if(!_imgView){
        _imgView = [UIImageView new];
        _imgView.contentMode = UIViewContentModeScaleAspectFill;
    }
    return _imgView;
}

- (UILabel *)detailLbl{
    if(!_detailLbl){
        _detailLbl = [UILabel new];
        _detailLbl.textColor = UIColor.whiteColor;
        _detailLbl.font = [UIFont fontWithWeight:MTBold size:PTW(20)];
        _detailLbl.textAlignment = NSTextAlignmentCenter;
        _detailLbl.numberOfLines = 0;
    }
    return _detailLbl;
}

- (void)setImgView:(NSString *)img withTitle:(NSString *)text{
    self.imgView.image = KImaged(img);
    self.detailLbl.text = text;
}

@end
